/*
* @author suhong
* @date 2022/5/20 22:39
* @file mixin.js
* @说明  
*/
export const mixin={
    methods:{
        dateMain(timestamp){
            let newDate = Date.parse(new Date());
            let date = new Date(timestamp);
            let dateDiff = newDate - date;
            if (dateDiff < 3600000) {
                return Math.round(dateDiff / 1000 / 60) === 0 ? '刚刚' : Math.round(dateDiff / 1000 / 60) + '分钟前';
            }
            let h = date.getHours() > 10 ? date.getHours() + ':' : '0' + date.getHours() + ':';
            let m = date.getMinutes() > 10 ? date.getMinutes() : '0' + date.getMinutes();
            return h + m

        }
    }
}
